﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using QLTV_Public;
namespace QLTV_Data
{
   public class LoaiDocGia_Data
    {
       KetNoiCSDL_Data kn = new KetNoiCSDL_Data();
       public DataTable TaoBang(string sql)
       {
           return kn.taobang(sql);
       }
       public DataTable LayDuLieu()
       {
           return kn.LayDuLieu("Load_LoaiDocGia");
       }
       public int Insert(LoaiDocGia_Public maLoai, LoaiDocGia_Public tenLoai)
       {
           int Nparameter = 2;
           string[] name = new string[Nparameter];
           object[] value = new object[Nparameter];
           name[0] = "@MaLoaiDG";
           value[0] = maLoai.MaLoaiDG;
           name[1] = "@TenLoaiDG";
           value[1] = tenLoai.TenLoaiDG;

           return kn.update("Insert_LoaiDocGia",name,value,Nparameter);
       }
       public int Update(LoaiDocGia_Public maLoai, LoaiDocGia_Public tenLoai)
       {
           int Nparameter = 2;
           string[] name = new string[Nparameter];
           object[] value = new object[Nparameter];
           name[0] = "@MaLoaiDG";
           value[0] = maLoai.MaLoaiDG;
           name[1] = "@TenLoaiDG";
           value[1] = tenLoai.TenLoaiDG;

           return kn.update("Update_LoaiDocGia", name, value, Nparameter);
       }
       public int Delete(LoaiDocGia_Public maLoai)
       {
           int Nparameter = 1;
           string[] name = new string[Nparameter];
           object[] value = new object[Nparameter];
           name[0] = "@MaLoaiDG";
           value[0] = maLoai.MaLoaiDG;

           return kn.update("Delete_LoaiDocGia", name, value, Nparameter);
       }
    }
}
